<extend name="./public/frame.html"/>
<block name="content">
    <form class="layui-form" action="" method="post" enctype="multipart/form-data">
        <input name="id" type="hidden" value="{$info['id']}" />
        <table class="layui-table" style="width: 40%">
            <tr>
                <td style="text-align: center;">类型</td>
                <td>
                    <select name="type" class="layui-input" lay-filter="type" lay-verify="required">
                        <option value="{$info['type']}" selected >{$type_name}</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td style="text-align: center;width: 174px;height: 40px;">热门城市</td>
                <td>
                    <if condition="$info['type'] eq 3">
                    <div id="city_list">
                        <select name="area_id" class="layui-input area_id" lay-filter="area_id" readonly>
                            <option value="{$info['area_id']}">{$info['area_name']}</option>
                        </select>
                    </div>
                        <else />
                    <div class="layui-input-block pro-city" style="margin-left: 0;">
                        <div class="layui-row" style="float:left;">
                            <div class="layui-form">
                                <div class="layui-inline">
                                    <div class="layui-input-inline" >
                                        <select name="province_id" id="province_id" class="layui-input" lay-filter="province">
                                            <option value="{$info['province_id']}">{$info['province_name']}</option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-row" style="float:left;margin-left: 5px;">
                            <div class="layui-form">
                                <div class="layui-inline">
                                    <div class="layui-input-inline" style="width: 200px;margin-right: 5px;">
                                        <select name="city_id" id="city_id" class="layui-input" lay-filter="city">
                                            <option value="{$info['city_id']}">{$info['city_name']}</option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    </if>
                </td>
            </tr>
            <tr>
                <td style="text-align: center;">排序</td>
                <td>
                    <input name="sort_no" type="text" value="{$info['sort_no']}" lay-verify="required|number" class="layui-input" autocomplete="off" placeholder="输入数字越大越靠前" onkeyup="value=value.replace(/[^\d]+/g,'')"/>
                </td>
            </tr>
            <tr>
                <td style="text-align: center;">备注</td>
                <td>
                    <input name="remark" type="text" value="{$info['remark']}" class="layui-input" placeholder="请输入备注信息（非必填）"/>
                </td>
            </tr>
        </table>
        <button class="layui-btn" lay-submit="" lay-filter="submit">提交</button>
        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
    </form>
    <script>
        layui.use(['form','layer'], function () {
            var form = layui.form;
            var layer = layui.layer;

//            form.on('select(type)', function (data) {
//                var type = data.value;
//
//                if(type == 3) {
//                    $(".pro-city").css('display','none');
//                    $("#province_id").attr('lay-verify','');
//                    $("#city_id").attr('lay-verify','');
//
//                    var url = "{:url('admin/hotCity/get_area_list')}";
//                    $.post(url,{'type':type},function(res){
//                        $("#city_list").html('');
//                        $("#city_list").html(res.data);
//                    },'json');
//                } else {
//                    $("#city_list").html('');
//                    $(".pro-city").show();
//                    $("#province_id").attr('lay-verify','required');
//                    $("#city_id").attr('lay-verify','required');
//                }
//            });

//            form.on('select(province)', function(data){
//                $("#city_id").empty();
//                $("#city_id").append('<option value=>请选择城市</option>');
//                var province_id = data.value;
//                $.ajax({
//                    url:'{:url("/admin/Franchisee/cityList")}',
//                    async:true,
//                    //dataType:'json',
//                    type:'post',
//                    data:{'province_id':province_id},
//                    success:function(res){
//                        $("#city_id").append(res);
//                        form.render('select');
//                    },
//                    error:function(e){
//                        layer.msg('请求错误');return false;
//                    }
//                })
//            });
        });


    </script>
</block>